<%@ page language="java" import="weaver.conn.RecordSet" pageEncoding="UTF-8" %>
<script type="text/javascript">
    WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, function(callback){
        changeYylxDtl();
        callback();    //继续提交需调用callback，不调用代表阻断
    });

    var yyxtlx1_fieldid = WfForm.convertFieldNameToId("yyxtlx1");
    var yyxtlx_fieldid = WfForm.convertFieldNameToId("yyxtlx", "detail_1");
    WfForm.bindDetailFieldChangeEvent(yyxtlx_fieldid,function(id,rowIndex,value){
        var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
        var yyxtlxs = "";
        for(var i=0; i<rowArr.length; i++){
            var yyxtlxvalue = WfForm.getFieldValue(yyxtlx_fieldid+"_"+rowArr[i]);
            if(yyxtlxs.indexOf(yyxtlxvalue)<0){
                yyxtlxs += yyxtlxs==""?yyxtlxvalue:","+yyxtlxvalue;
            }
        }
        WfForm.changeFieldValue(yyxtlx1_fieldid, {value:yyxtlxs});
    });
    //明细表1应用类型赋值到主表
 function changeYylxDtl() {
     var yyxtlx1_fieldid = WfForm.convertFieldNameToId("yyxtlx1");
     var yyxtlx_fieldid = WfForm.convertFieldNameToId("yyxtlx", "detail_1");
     var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
     var yyxtlxs = "";
     for(var i=0; i<rowArr.length; i++){
         var yyxtlxvalue = WfForm.getFieldValue(yyxtlx_fieldid+"_"+rowArr[i]);
         if(yyxtlxs.indexOf(yyxtlxvalue)<0){
             yyxtlxs += yyxtlxs==""?yyxtlxvalue:","+yyxtlxvalue;
         }
     }
     WfForm.changeFieldValue(yyxtlx1_fieldid, {value:yyxtlxs});
 }
</script>

